this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(t,e){"use strict";function n(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t\t\t<div class="','">\n\t\t\t\t\t\t\t\t\t\t',"\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t"]);n=function e(){return t};return t}function r(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t<div class="row ','">\n\t\t\t\t\t\t\t',"\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"]);r=function e(){return t};return t}function i(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="container">\n\t\t\t\t',"\n\t\t\t</div>\n\t\t"]);i=function e(){return t};return t}function a(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<div class="col-1 grid-item grid-item-last" onclick="','">\n\t\t\t\t\t\t\t\t<div></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t']);a=function e(){return t};return t}function o(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<div class="',' grid-item" onclick="','">\n\t\t\t\t\t\t\t\t<div data-ready="true" data-rowNumber="','" data-colNumber="','">',"</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t"]);o=function e(){return t};return t}function l(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t<div class="landing-bootstrap-layout-add-row" onclick="','">\n\t\t\t\t\t\t\t+\n\t\t\t\t\t\t</div>\n\t\t\t\t\t']);l=function e(){return t};return t}function s(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t<div class="landing-bootstrap-layout-remove-row" onclick="','">\n\t\t\t\t\t\t\t-\n\t\t\t\t\t\t</div>\n\t\t\t\t\t']);s=function e(){return t};return t}function u(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-bootstrap-layout-work container">\n\t\t\t\t<div class="row">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t"]);u=function e(){return t};return t}function c(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-bootstrap-layout-wrapper-col-menu">\n\t\t\t\t<div data-command="remove">x</div>\n\t\t\t\t<div data-command="decrease">&larr;</div>\n\t\t\t</div>\n\t\t']);c=function e(){return t};return t}function d(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t\t<div class="col grid-item">\n\t\t\t\t\t\t\t\t<div></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t']);d=function e(){return t};return t}function f(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-bootstrap-layout-background container">\n\t\t\t\t<div class="row">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t"]);f=function e(){return t};return t}function h(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t<span onclick="','" class="','">',"</span>\n\t\t\t\t\t"]);h=function e(){return t};return t}function g(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-bootstrap-layout-switcher">\n\t\t\t\t',"\n\t\t\t</div>\n\t\t"]);g=function e(){return t};return t}function v(){var t=babelHelpers.taggedTemplateLiteral(['<div class="landing-bootstrap-layout-wrapper"></div>']);v=function e(){return t};return t}var p=function(){function t(){babelHelpers.classCallCheck(this,t)}babelHelpers.createClass(t,null,[{key:"getWrapper",value:function t(){return e.Tag.render(v())}},{key:"getModeSelector",value:function t(n,r){return e.Tag.render(g(),["md","sm","xs"].map(function(t){return e.Tag.render(h(),function(){return r?r(t):{}},n===t?"active":"",t)}))}},{key:"getBackground",value:function t(){return e.Tag.render(f(),babelHelpers.toConsumableArray(new Array(12)).map(function(){return e.Tag.render(d())}))}},{key:"getHoverColMenu",value:function t(){return e.Tag.render(c())}},{key:"getWorkGrid",value:function t(n){var r=0;var i=parseInt(n.rowNumber);var c=n.rowsNumber,d=n.cols,f=n.onNewRowClick,h=n.onRemoveRowClick,g=n.onIncColClick,v=n.onNewColClick;return e.Tag.render(u(),c<=1?"":e.Tag.render(s(),function(){return h?h(i):{}}),e.Tag.render(l(),function(){return f?f(i):{}}),d.map(function(t,n){r+=t>0?t:1;return e.Tag.render(o(),t>0?"col-".concat(t):"col",function(){return g?g(i,n):{}},i,n,t)}),r>=12?"":e.Tag.render(a(),function(){return v?v(i):{}}))}},{key:"getResult",value:function t(a){return e.Tag.render(i(),a.map(function(t){return e.Tag.render(r(),t["classes"]?t["classes"]:"",t["cols"].map(function(t,r){var i=t.classes?t.classes.split(" "):[];Object.keys(t.sizes).map(function(e){var n=e==="xs"?"col-".concat(t.sizes[e]):"col-".concat(e,"-").concat(t.sizes[e]);if(!i.includes(n)){i.push(n)}});return e.Tag.render(n(),i.join(" "),t.content?t.content:'<div class="test-height"></div>')}))}))}}]);return t}();function b(t,e){var n;if(typeof Symbol==="undefined"||t[Symbol.iterator]==null){if(Array.isArray(t)||(n=m(t))||e&&t&&typeof t.length==="number"){if(n)t=n;var r=0;var i=function t(){};return{s:i,n:function e(){if(r>=t.length)return{done:true};return{done:false,value:t[r++]}},e:function t(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a=true,o=false,l;return{s:function e(){n=t[Symbol.iterator]()},n:function t(){var e=n.next();a=e.done;return e},e:function t(e){o=true;l=e},f:function t(){try{if(!a&&n.return!=null)n.return()}finally{if(o)throw l}}}}function m(t,e){if(!t)return;if(typeof t==="string")return C(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(t,e)}function C(t,e){if(e==null||e>t.length)e=t.length;for(var n=0,r=new Array(e);n<e;n++){r[n]=t[n]}return r}var w=function(){function t(n,r){var i=this;babelHelpers.classCallCheck(this,t);babelHelpers.defineProperty(this,"currentSize","md");babelHelpers.defineProperty(this,"gridMatrix",[]);this.container=n;this.colMenu=p.getHoverColMenu();if(r){this.result=r.result||null}this.onChangeView=this.onChangeView.bind(this);this.onNewRowClick=this.onNewRowClick.bind(this);this.onRemoveRowClick=this.onRemoveRowClick.bind(this);this.onIncColClick=this.onIncColClick.bind(this);this.onNewColClick=this.onNewColClick.bind(this);e.Event.bind(this.container,"mouseover",function(t){i.onMouseOver(t)});e.Event.bind(this.container,"mouseout",function(t){i.onMouseOut(t)});e.Event.bind(this.colMenu,"click",function(t){i.onColMenuClick(t)});this.loadMatrix();this.drawMatrix()}babelHelpers.createClass(t,[{key:"getResult",value:function t(){return p.getResult(this.gridMatrix)}},{key:"getColsInRow",value:function t(e){var n=this;var r=[];if(this.gridMatrix[e]){this.gridMatrix[e].cols.map(function(t){r.push(t.sizes[n.currentSize]?t.sizes[n.currentSize]:0)})}return r}},{key:"getSumInRow",value:function t(e){return this.getColsInRow(e).reduce(function(t,e){return t+e})}},{key:"fillZero",value:function t(e){var n=this;var r=this.getColsInRow(e);if(r[0]<=0){var i=this.gridMatrix[e]["cols"].length;var a=parseInt(12/i);this.gridMatrix[e]["cols"].map(function(t){t.sizes[n.currentSize]=a})}}},{key:"querySelectorAll",value:function t(e,n,r){var i=[];var a=b(e.querySelectorAll("[".concat(r,"]"))),o;try{for(a.s();!(o=a.n()).done;){var l=o.value;if(n.test(l.getAttribute(r))){i.push(l)}}}catch(t){a.e(t)}finally{a.f()}return i}},{key:"loadMatrix",value:function t(){var e=this;this.gridMatrix=[];if(this.result){babelHelpers.toConsumableArray(this.result.querySelectorAll(".row")).map(function(t){var n=[];babelHelpers.toConsumableArray(e.querySelectorAll(t,/col[a-z-]*[\d]+/,"class")).map(function(t){var e={sizes:{}};var r=t.getAttribute("class");var i=r.match(/col-([a-z]+)-([\d]+)/g);var a=r.match(/col-([\d]+)/g);if(i){i.map(function(t){e.sizes[t.split("-")[1]]=parseInt(t.split("-")[2])})}if(a){a.map(function(t){e.sizes["xs"]=parseInt(t.split("-")[1])})}if(i||a){e["content"]=t.innerHTML;e["classes"]=t.getAttribute("class").replace(/col[a-z-]*[\d]+/g,"");n.push(e)}});e.gridMatrix.push({classes:t.getAttribute("class")||null,cols:n})});console.log(this.gridMatrix)}}},{key:"drawMatrix",value:function t(){var n=this;e.Dom.clean(this.container);this.container.appendChild(this.colMenu);var r=this.gridMatrix.length;this.container.appendChild(p.getModeSelector(this.currentSize,this.onChangeView));Object.keys(this.gridMatrix).map(function(t){var e=p.getWrapper();var i=n.getColsInRow(t);e.appendChild(p.getBackground());e.appendChild(p.getWorkGrid({rowNumber:t,rowsNumber:r,cols:i,onNewRowClick:n.onNewRowClick,onRemoveRowClick:n.onRemoveRowClick,onIncColClick:n.onIncColClick,onNewColClick:n.onNewColClick}));n.container.appendChild(e)});if(this.result){e.Dom.clean(this.result);this.result.appendChild(this.getResult())}}},{key:"onChangeView",value:function t(e){this.currentSize=e;this.drawMatrix()}},{key:"onRemoveRowClick",value:function t(e){this.gridMatrix=this.gridMatrix.filter(function(t,n){return n!==e});this.drawMatrix()}},{key:"onNewRowClick",value:function t(e){if(this.gridMatrix[e]){var n={};n[this.currentSize]=1;var r={classes:null,cols:[{sizes:n}]};this.gridMatrix.splice(e+1,0,r)}this.drawMatrix()}},{key:"onIncColClick",value:function t(e,n){this.fillZero(e);if(this.getSumInRow(e)<12){this.gridMatrix[e]["cols"][n]["sizes"][this.currentSize]++}this.drawMatrix()}},{key:"onDecColClick",value:function t(e,n){this.fillZero(e);if(this.gridMatrix[e]){if(this.gridMatrix[e]["cols"][n]["sizes"][this.currentSize]>1){this.gridMatrix[e]["cols"][n]["sizes"][this.currentSize]--}else{this.onRemoveColClick(e,n);return}}this.drawMatrix()}},{key:"onNewColClick",value:function t(e){this.fillZero(e);if(this.gridMatrix[e]){var n={};n[this.currentSize]=1;this.gridMatrix[e]["cols"].push({sizes:n})}this.drawMatrix()}},{key:"onRemoveColClick",value:function t(e,n){this.fillZero(e);if(this.gridMatrix[e]){this.gridMatrix[e]["cols"]=this.gridMatrix[e]["cols"].filter(function(t,e){return e!==n})}this.drawMatrix()}},{key:"showColMenu",value:function t(){this.colMenu.style.display="block"}},{key:"hideColMenu",value:function t(){this.colMenu.style.display="none"}},{key:"onMouseOver",value:function t(n){var r=null;n.path.map(function(t){if(!(t&&t.nodeType===Node.ELEMENT_NODE)){return}if(t.getAttribute("data-ready")){r=t}});if(r){var i=n.target.getBoundingClientRect();this.showColMenu();this.colMenu.setAttribute("data-rowNumber",r.getAttribute("data-rowNumber"));this.colMenu.setAttribute("data-colNumber",r.getAttribute("data-colNumber"));e.Dom.style(this.colMenu,{top:i.top+window.scrollY+"px",left:i.left+i.width+window.scrollX-20+"px"})}}},{key:"onMouseOut",value:function t(e){if(!e.target.getAttribute("data-ready")){this.hideColMenu()}}},{key:"onColMenuClick",value:function t(e){var n=e.target.getAttribute("data-command");if(n==="decrease"){this.onDecColClick(parseInt(e.target.parentNode.getAttribute("data-rowNumber")),parseInt(e.target.parentNode.getAttribute("data-colNumber")))}else{this.onRemoveColClick(parseInt(e.target.parentNode.getAttribute("data-rowNumber")),parseInt(e.target.parentNode.getAttribute("data-colNumber")))}this.hideColMenu()}}]);return t}();t.Layout=w})(this.BX.Landing.UI.Bootstrap=this.BX.Landing.UI.Bootstrap||{},BX);
//# sourceMappingURL=landing.ui.bootstrap.layout.bundle.map.js